package anc.tankshooter.map;

public class AstartNode{
	public int i;
	public int j;
	public float g;
	public float h;
	public float f;
	public AstartNode mParentNode;
	
	public AstartNode(int i,int j){
		this.i=i;
		this.j=j;
		this.f=this.g+this.h;
		this.mParentNode=null;
	}
	public AstartNode(int i,int j,float g,float h,AstartNode parentNode){
		this.i=i;
		this.j=j;
		this.g=g;
		this.h=h;
		this.f=this.g+this.h;
		this.mParentNode=parentNode;
	}
	
	public float distance(AstartNode node){
		return (float) Math.sqrt(Math.pow(node.i-this.j, 2)+Math.pow(node.j-this.j, 2));
	}
	
	@Override
	public boolean equals(Object o) {
		boolean isEqual = false;
		if(o instanceof AstartNode){
			AstartNode node  = (AstartNode)o;
			isEqual = ((this.i==node.i) && (this.j == node.j));
		}
		return isEqual;
	}
	
	@Override
	public String toString() {
		return " ("+i+","+j+") ";
	}
}